package com.ruoyi.tenant.service.impl;

import java.util.List;

import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.framework.datasource.DynamicDataSourceContextHolder;
import com.ruoyi.tenant.domain.SysAdvice;
import com.ruoyi.tenant.mapper.SysAdviceMapper;
import com.ruoyi.tenant.service.ISysAdviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class SysAdviceServiceImpl implements ISysAdviceService
{
    @Autowired
    private SysAdviceMapper sysAdviceMapper;

    @Override
    public SysAdvice selectSysAdviceById(Long id)
    {
        return sysAdviceMapper.selectSysAdviceById(id);
    }

    @Override
    public List<SysAdvice> selectSysAdviceList(SysAdvice sysAdvice)
    {
        return sysAdviceMapper.selectSysAdviceList(sysAdvice);
    }

    @Override
    public int insertSysAdvice(SysAdvice sysAdvice)
    {
        DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name());
        return sysAdviceMapper.insertSysAdvice(sysAdvice);
    }

    @Override
    public int updateSysAdvice(SysAdvice sysAdvice)
    {
        return sysAdviceMapper.updateSysAdvice(sysAdvice);
    }

    @Override
    public int deleteSysAdviceByIds(Long[] ids)
    {
        return sysAdviceMapper.deleteSysAdviceByIds(ids);
    }

    @Override
    public int deleteSysAdviceById(Long id)
    {
        return sysAdviceMapper.deleteSysAdviceById(id);
    }
}
